﻿#pragma once

#include "../MonsterObject.h"
#include "../../Settings.h"
#include "../../MirDatabase/MonsterInfo.h"
#include "../../../Shared/Enums.h"
#include "../PlayerObject.h"
#include "../MapObject.h"
#include "../../../Shared/Packet.h"

using namespace Server::MirDatabase;
using namespace Server::MirEnvir;
namespace S = ServerPackets;

namespace Server::MirObjects::Monsters
{
    class HellLord : public MonsterObject
    {
    protected:
        bool getCanMove() const override;
        bool getCanRegen() const override;

    private:
        unsigned char _stage = 0;
        bool _begin = false;

        bool _raged = false;
        long long _rageDelay = Settings::Minute * 2;
        long long _rageTime = 0;

        int _bombChance = 3;
        int _bombSpreadMin = 5;
        int _bombSpreadMax = 20;

        int _quakeSpreadMin = 5;
        int _quakeSpreadMax = 15;
        int _quakeCount = 5;

    protected:
        HellLord(MonsterInfo *info);

        bool InAttackRange() override;

    public:
        void Turn(MirDirection dir) override;
        bool Walk(MirDirection dir) override;


        int Attacked(MonsterObject *attacker, int damage, DefenceType type = DefenceType::ACAgility) override;
        int Attacked(PlayerObject *attacker, int damage, DefenceType type = DefenceType::ACAgility, bool damageWeapon = true) override;

        void ApplyPoison(Poison *p, MapObject *Caster = nullptr, bool NoResist = false, bool ignoreDefence = true) override;

        void Process() override;

    protected:
        void ProcessTarget() override;

        void Attack() override;

    private:
        void SpawnQuakes();

        void SpawnBomb();

        void SpawnKnight();

    public:
        void KnightKilled();

        Packet *GetInfo() override;
    };
}
